/**
 * 
 */
package il.ac.bgu.cs.heuristics.core;

import il.ac.bgu.cs.heuristics.graph.types.IState;
import il.ac.bgu.cs.heuristics.utils.CollectionUtils;

import java.util.Map;

/**
 * @author haro
 * 
 */
public class BackTrackerHelper {
	KeyClass					lastEntry;
	Map<KeyClass, ValueClass>	problemsLog	= CollectionUtils.newHashMap();

	void addCurrentProblem(int currentHvalue, IState init, IState goal) {
		KeyClass key = new KeyClass(init, goal);
		if (problemsLog.containsKey(key)) {
			throw new UnsupportedOperationException(
					"this problem already exsit in the problemLog");
		}
		ValueClass value = new ValueClass(currentHvalue);
		problemsLog.put(key, value);
		lastEntry = key;
	}

	void testProblem(IState init, IState goal) {

	}

	private class KeyClass {
		public KeyClass(IState init, IState goal) {
			this.init = init;
			this.goal = goal;
		}

		IState	init;
		IState	goal;
	}

	private class ValueClass {
		public ValueClass(int hValue) {
			this.hValue = hValue;
			nextKeyClass = null;
		}

		int			hValue;
		KeyClass	nextKeyClass;
	}

}
